# Filetypes
# ────────────────────────────────────────────────────
hook global BufCreate .+[rc|\.local|\.conf|\.sh] %{
  set-option buffer filetype sh
}

hook global WinSetOption filetype=(asciidoc|fountain|html|latex|markdown) %{
    require-module pandoc
    set-option global pandoc_options '-d default'
}

# Keybinding
# ────────────────────────────────────────────────────
hook global InsertChar j %{ try %{
  exec -draft hH <a-k>kj<ret> d
  exec <esc>
}}

map global normal '#' :comment-line<ret> -docstring 'comment line'
map global normal '<a-#>' :comment-block<ret> -docstring 'comment block'
map global normal = :format<ret> -docstring 'format buffer'

map global user | ':tmux-terminal-horizontal kak -c %val{session}<ret>' -docstring 'split H'
map global user = ':tmux-terminal-vertical kak -c %val{session}<ret>' -docstring 'split V'
map global user 'f' ": kaktree-toggle<ret>" -docstring "toggle filetree panel"
map global user l ': enter-user-mode lsp<ret>' -docstring 'lsp'
